<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1">


        <title>北京循一堂健康管理有限公司</title>

        <link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css">
		<link href="./plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" type="text/css">
        <link href="./plugins/bootstrap-datepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
	    <link rel="stylesheet" type="text/css" href="./css/page.css"/>
	    <link rel="stylesheet" href="./css/xxxx.css">
    </head>


    <body class="fixed-left">
          <script src="./js/jquery.min.js"></script>
          <script type="text/javascript"> 
			$(function(){	
				$(".tab").slide({     //切换新闻
					titCell:".hd li",
					mainCell:".bd",
					targetCell:".more li",
					effect:"fade",
					autoPlay:false,
					trigger:"click",
					easing:"linear",
					delayTime:0
				});
				
				$(".yylb .tab").slide({     //切换新闻
					titCell:".hd li",
					mainCell:".bd",
					targetCell:".more li",
					effect:"fade",
					autoPlay:false,
					trigger:"click",
					easing:"linear",
					delayTime:0
				});

			});
			
			function ScrollImgLeft(){ 
			var speed=50; 
			var scroll_begin = document.getElementById("scroll_begin"); 
			var scroll_end = document.getElementById("scroll_end"); 
			var scroll_div = document.getElementById("scroll_div"); 
			scroll_end.innerHTML=scroll_begin.innerHTML; 
			function Marquee(){ 
			if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0) 
			scroll_div.scrollLeft-=scroll_begin.offsetWidth; 
			else 
			scroll_div.scrollLeft++; 
			} 
			var MyMar=setInterval(Marquee,speed); 
			scroll_div.onmouseover=function() {clearInterval(MyMar);} 
			scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed);} 
			} 
		</script> 
		<div class="header">
			<div class="container right-b clearfix">
				<div class="logo fl"><img src="./images/logo.jpg"/></div>
				
				<div class="center fl">									 
					<div style="width:96%;height:21px;margin:0 auto;white-space: nowrap;overflow:hidden;" id="scroll_div" class="scroll_div"> 
						<div id="scroll_begin"> 					
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
						</div> 
						<div id="scroll_end"></div> 
					</div> 
					<script type="text/javascript">ScrollImgLeft();</script> 				 
				</div>
				
				<div class="data fr clearfix">
					<div class="tx">
						<img src="./images/logo.jpg" alt="" height="50"/>
					</div>	
					<div class="name">
						<button onclick="">退出登录</button>
						<p>欢迎胡凤亮医生<button onclick="" id="name"></button></p>
					</div>
					
					
				</div>
			</div>
		</div>
		<div class="main clearfix">
			<div class="tab fl">
			  
						<div class="bd container">
							<ul class="hzk">
								<div class="ss">
									<input type="text" name="" id="moreSearch" value="" />
									<button type="button">搜索</button>
								</div>

								<div id="userToolbar" class="btn-group">
									<button id="btn_add" type="button" class="btn btn-default">
										<!-- <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>-->发送消息 
									</button>
									<!-- <button id="btn_edit" type="button" class="btn btn-default"  data-toggle="modal" data-target="#myModal">
										<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>编辑简历
									</button>
									<button id="btn_delete" type="button" class="btn btn-default">
										<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除简历
									</button>
	 -->
								</div>	
							<table id="userTable"></table>	
							</ul>
								
						</div>
					</div>
			
		</div>

		<!-- 模态框（Modal）查看 -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title" id="myModalLabel">
							患者详情
						</h4>
					</div>
					<div class="modal-body" style="padding: inherit">
						<!-- <form class="form-horizontal" id="addPartyForm">
							<div class="form-group">
								<label for="org_orgName" class="col-sm-2 control-label">群组名称:</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" name="name" id="addgroupname" />
								</div>
							</div>

						</form> -->
						<div class="xxxx-box">
							<!-- <div class="xxxx_head">
								<ul>
									<li class="xxxx_li1">患者信息</li>
									<li class="xxxx_li2"><a href=""><img src="img/back.png"/></a></li>
								</ul>
							</div> -->
							<div class="xxxx_center">
								<div class="xxxx_left">
									<ul>
										<li class="xxxx_left_li1"><img src="./images/touxiang.png"/></li>
										<!-- <li class="xxxx_left_li2">张某某</li>
										<li class="xxxx_left_li3">档案号：876108</li>
										<li class="xxxx_left_li3">性&nbsp&nbsp别：男</li>
										<li class="xxxx_left_li3">年&nbsp&nbsp龄：35岁</li> -->
									</ul>
								</div>
								<div class="xxxx_right">
									<div class="xxxx_right_first">
										<div class="xxxx_right_head">
											<ul>
												<li>基本信息</li>
											</ul>
										</div>
										<div class="xxxx_right_first_down">
											<ul>
												<li class="xxxx_right_first_down_li">姓&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp名：<span id="patientname">张毛毛</span></li>
												<li class="xxxx_right_first_down_li">姓&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp名：<span id="patientsex">女</span></li>
												<li class="xxxx_right_first_down_li">出生年月：<span id="patientbirthday">1974-01-01</span></li>
												<li class="xxxx_right_first_down_li">年&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp龄：<span id="patientage">30</span>岁</li>
												<li class="xxxx_right_first_down_li">手机号码：<span id="patientphone">138******</span></li>
												<li class="xxxx_right_first_down_li">身份证号：<span id="patientid">1310251563548562</span></li>
												<li class="xxxx_right_first_down_li">婚姻状况：<span id="patientmarray">已婚</span></li>
												<li class="xxxx_right_first_down_li">民&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp族：<span id="patientnation">汉</span></li>
												<li style="width: 100%;" class="xxxx_right_first_down_li">备&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp注：
													<div class="xxxx_right_first_down_border" id="patientremark">
														
													</div>
												</li>
											</ul>
										</div>
									</div>
									<div class="xxxx_right_second">
										<div class="xxxx_right_head">
											<ul>
												<li>病例信息</li>
											</ul>
										</div>
										<div class="xxxx_right_first_down">
											<ul>							
												<li style="width: 100%;"class="xxxx_right_first_down_li">过敏史：
													<div class="xxxx_right_first_down_border" id="patientguomin">
														
													</div>
												</li>
												<li style="width: 100%;"class="xxxx_right_first_down_li">家族病史：
													<div class="xxxx_right_first_down_border" id="patientjiazu">
														
													</div>
												</li>
												<li style="width: 100%;"class="xxxx_right_first_down_li">个人病史：
													<div class="xxxx_right_first_down_border" id="patientgeren">
														
													</div>
												</li>
												<li style="width: 100%;"class="xxxx_right_first_down_li">个人病例：
													<div class="xxxx_right_first_down_border_new" id="patientcase">

													</div>
												</li>
											</ul>
										</div>
									</div>
								</div>
							</div>
				
						</div>

					<!-- <div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭
						</button>
						<button type="button" class="btn btn-primary" id="userSaveBtn">
							保存
						</button> 
					</div>-->
				</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
		</div>

		<!-- 模态框（Modal） -->
		<div class="modal fade" id="editPwdModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							&times;
						</button>
						<h4 class="modal-title" id="myModalLabel1">
							消息发送
						</h4>
					</div>
					<div class="modal-body">
						<form class="form-horizontal" id="editForm">
							<div class="form-group">
								<label for="org_orgName" class="col-sm-2 control-label">标题:</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" name="name" id="newpwd" />
								</div>
							</div>
							<div class="form-group">
								<label for="org_isUse" class="col-sm-2 control-label">内容:</label>
								<div class="col-sm-10">
									<!-- <input type="text" class="form-control" name="sex" id="newpwd2" /> -->
									<textarea rows="3" cols="20"></textarea>
								</div>
							</div>
						</form>
					</div>

					<div class="modal-footer">
						<!-- <button type="button" class="btn btn-default" data-dismiss="modal">发送
						</button> -->
						<button type="button" class="btn btn-primary" data-dismiss="modal" id="editPwdBtn">
							发送
						</button>
					</div>
				</div><!-- /.modal-content -->
			</div><!-- /.modal -->
		</div>


		<br>
		<br>
		<br>
		<br>
		<br>
		<div class="footer" style="left:0px">
			<p>版权所有  © 2018-2020 北京循一堂健康管理有限公司&nbsp;&nbsp;&nbsp;技术支持电话：010-62084321</p>
		</div>
        <script>
            var resizefunc = [];
        </script>

        <!-- jQuery  -->
        <script src="./js/bootstrap.min.js"></script>
        <script src="./plugins/select/js/bootstrap-select.min.js"></script>
    
        <script src="./plugins/bootstrap-table/bootstrap-table.min.js"></script>
        <script src="./plugins/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
        
        <script src="./plugins/bootstrap-datepicker/js/moment.js"></script>
        <script src="./plugins/bootstrap-datepicker/js/bootstrap-datetimepicker.min.js"></script>
        <script src="./js/jquery.SuperSlide.2.1.1.js" type="text/javascript" charset="utf-8"></script>
	
		<script type="text/javascript">
			window.baseUrl=localStorage.getItem("baseUrl");
			window.sessionid=localStorage.getItem("sessionid");
			window.moreSearch="";
            jQuery(document).ready(function($) {
				var doctorId=localStorage.getItem("doctorId"); 
                $('#contentDiv').find('li').each(function() {
                    $(this).click(function() {
                        var index=$(this).index();
                        if(index==0){
                            window.location.href="patientlibrary.html";
                        }else if(index==1){
                            window.location.href="appointlist.html";
                        }else if(index==2){
                            window.location.href="workplan.html";
                        // }else if(index==3){
                        //     window.location.href="workplan.html";
                        }else if(index==3){
                            window.location.href="usercenter.html";
                        }else if(index==4){
                            window.location.href="medicalservice.html";
                        }else if(index==5){
                            window.location.href="./im/main.html";
                        }else if(index==7){

                        }else if(index==8){

                        }else if(index==9){

                        }
                    })
                });
                
            	$('#datetimepicker').datetimepicker({
            		format:"YYYY-MM-DD HH:MM:SS"
            	});  
            	
            	var $table = $('#userTable');
            	var $remove = $('#btn_delete'),
            	$add = $('#btn_add'),
            	$edit = $('#btn_edit'),
            	toolbar = "#userToolbar";
					
            	$table.bootstrapTable({
            		contentType: "application/x-www-form-urlencoded",
            		method:"post",
                    toolbar : toolbar,
                    showRefresh : true,
                    showToggle:true,
                    pagination:true,
                    showColumns:true,
                    idField : "id",
                    sortName : 'createtime',
                    sortOrder : 'desc',
                    pageSize: 10,
                    pageList: [10, 25, 50, 100],
                    queryParamsType:"",
                    queryParams:function(params) {
                    	//将查询条件添加到查询参数中，分页或者刷新时将携带这些参数
                    	params["moreSearch"] = window.moreSearch;
                    	params["pageNumber"] = params.pageNumber;
                    	params["pageSize"] = params.pageSize;
                    	params["sortOrder"]=params.sortOrder;
						params["sortName"]=params.sortName;
						params["doctorId"]=doctorId;
                    	return params;
                    }, 
                    sidePagination : "server",
                    url :window.baseUrl+"/xunyitang/westPatient/patientlist?jsessionid="+window.sessionid,
                    columns: [
                              {field:"state",checkbox:true}, 
                              {field: "id", title: "编号"},
                              {field: "name", title: "姓名",sortable: true}, 
                              {field: "sex", title: "性别",sortable: true},
                              {field: "age", title: "年龄",sortable: true},
                              {field: "history", title: "就医历史",sortable: true},
                              {field: "diagnose", title: "诊断",sortable: true},
                            //   {field: "bumen", title: "部门",sortable: true},
                              {field: "opt", title: "操作",
                             	 formatter:function(value,row){
                          			return '<button data-id="'+row.id+'"  class="b_ck fl" data-toggle="modal" data-target="#myModal"></button>'+
									'<button data-id="'+row.id+'"  class="b_fxx fl" data-toggle="modal" data-target="#editPwdModel"></button>';
									// '<button data-id="'+row.id+'"  class="b_lh fl"></button>';
                               	  }
                              }
                              
					],
					onLoadError: function(){  //加载失败时执行
						window.location.href="index.html";
					}
                });
                $table.on('check.bs.table uncheck.bs.table ' +
                        'check-all.bs.table uncheck-all.bs.table', function () {
                    initBtnStatus();
                });
              	//数据已添加到table中，onPostBody
                $table.on('post-body.bs.table',function(data){
                	initBtnStatus();
                	//为按钮绑定事件
                	$table.find(".b_ck").click(function(){
						var tempId = $(this).data().id;
						$.ajax({
							type: "POST",
							url: window.baseUrl+"/xunyitang/westPatient/patient?jsessionid="+window.sessionid,
							contentType: "application/x-www-form-urlencoded",
							data:{patientId:tempId},
							dataType: "json",
							async:false,
							beforeSend: function(request) {
								request.setRequestHeader("Token", localStorage.getItem("Authorization"));
							},
							success: function(data) {
								console.log(data.data);
								if(null!=data && null!=data.data){
									$("#patientname").html(data.data.name);
									$("#patientsex").html(data.data.sex);
									$("#patientbirthday").html(data.data.email);
									$("#patientage").html(data.data.age);
									$("#patientphone").html(data.data.phone);
									$("#patientid").html(data.data.idcard);
									$("#patientmarray").html(data.data.marriage);
									$("#patientnation").html(data.data.nation);
									$("#patientremark").html(data.data.remark);
									$("#patientguomin").html(data.data.allergic);
									$("#patientjiazu").html(data.data.familyhistory);
									$("#patientgeren").html(data.data.personalhistory);

								}
								
							},
							error: function(data) {
								window.location.href="index.html";
							}
						});
						var doctorid= localStorage.getItem("doctorId");
						$.ajax({
							type: "POST",
							url: window.baseUrl+"/xunyitang/westCase/caseList?jsessionid="+window.sessionid,
							contentType: "application/x-www-form-urlencoded",
							data:{patientId:tempId,doctorId:doctorid},
							dataType: "json",
							async:false, 
							beforeSend: function(request) {                
								request.setRequestHeader("Token", localStorage.getItem("Authorization"));
							},
							success: function(data) {
								if(null!=data && null!=data.rows && data.rows.length>0){
									for (let i = 0; i < data.rows.length; i++) {
										const element = data.rows[i];
										if(null!=element.createtime &&element.createtime.length>10){
											$("#patientcase").append('<ul><p class="xxxx_cleck">&nbsp&nbsp&nbsp&nbsp'+element.createtime.substring(0,10)+'初诊-就诊医生:胡凤亮</p>'+ 
															'<li class="xxxx_right_first_down_border_li"><div class="xxxx_detial">'+
															'<ul class="xxxx_detial_ul2"><li class="xxxx_detial_ul2_li1">主&nbsp&nbsp&nbsp&nbsp诉：</li><li class="xxxx_detial_ul2_li2">'+element.description+'</li></ul>'+
															'<ul class="xxxx_detial_ul2"><li class="xxxx_detial_ul2_li1">检&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp查：</li><li class="xxxx_detial_ul2_li2">'+element.diagnose+'</li></ul>'+
															'<ul class="xxxx_detial_ul2"><li class="xxxx_detial_ul2_li1">意&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp见：</li><li class="xxxx_detial_ul2_li2">'+element.advice+'</li></ul>'+
															'</div></li></ul>');
										}
										$('.xxxx_cleck').click(function(){  
											if($(this).siblings("li").hasClass('on')){  
												$(this).siblings("li").slideUp(500).removeClass("on");  
											}else{  
												// 首先要清除其他li标签的on类名
												$(this).parent().siblings().children("li").removeClass("on");
												// on类名是随便起的，也可是active什么的都行
												$(this).siblings("li").slideDown(500).addClass("on").parent().siblings().children("li").slideUp(500); 
											}  
										}); 
									}
								}

							},
							error: function(data) {
								window.location.href="index.html";
							}
						});

                    });
                });
              
              	//数据加载完成事件，onLoadSuccess
                $table.on('load-success.bs.table',function(){
                	initBtnStatus();
                });
                function initBtnStatus(){
                	var len = $table.bootstrapTable('getSelections').length;
                    $add.prop('disabled', !len);
                   // $edit.prop('disabled', len!=1);
                }
                function getFileIdSelections() {
                    return $.map($table.bootstrapTable('getSelections'), function (row) {
                        return row.fileid
                    });
                }
                function getIdSelections() {
                    return $.map($table.bootstrapTable('getSelections'), function (row) {
                        return row.id
                    });
                }
                
                $add.click(function () {
					$("#editPwdModel").modal("show");
                });
                
                $edit.click(function () {
                	$.map($table.bootstrapTable('getSelections'), function (row) {
                        $("#userName").val(row.uname);
                        $("#userSex").val(row.usex);
                        $("#userAge").val(row.xueli);
                        $("#userJob").val(row.roll);
                        $("#userBumen").selectpicker('val',row.bumen);
                        $("#userChannel").val(row.fro);
                        $("#userTime").val(row.disptime);
                        $("#userAttention").val(row.focus_member);
                        $('#userStatus').selectpicker('val',row.zhuangtai);
                        $("#userMemo").val(row.memo);
                        $("#datetimepicker").val(row.meettime);
                    });
                	
                });
                $("#saveBtn").click(function(){
                	var ids = getIdSelections();
                	var userStatus=$('#userStatus').val();
                	var userMemo=$('#userMemo').val();
                	var userInfo=$('#userInfo').val();
                	var userBumen=$('#userBumen').val();
                	var meettime=$("#datetimepicker").val();
					 $.ajax({
					    	url: "/updateJianli?id="+ids[0]+"&status="+userStatus+"&memo="+userMemo+"&bumen="+userBumen+"&meettime="+meettime,
					    	type: "GET",
					    	success:function (result){
					    		if (result.success==true){
					    			sweetAlert('更新成功');	
					    			refresh();
					    		}else{
					    			sweetAlert('更新失败,请重试!');	
					    			refresh();
					    		}
					    	}
				   });
                });
                $("#editPwdBtn").click(function () {
             	   var pwd = $("#newpwd").val();
            	   var pwd2 = $("#newpwd2").val();

            	   if(pwd == ""  ){
            	     alert("密码不能为空");
            	     return false;
            	   }
            	   if(pwd2 == ""  ){
            	    alert("密码不能为空");
            	     return false;
            	   }
            	   if(pwd != pwd2 ){
            		    alert("两次密码不一致");
            		     return false;
            		  }
					 $.ajax({
					    	url: "/modifypwd?pid=${member.member_id}&pname=${member.username}&newpwd="+pwd,
					    	type: "GET",
					    	success:function (result){
					    		sweetAlert('更新成功');	
					    	}
				   });
                });
                //刷新并跳转到第一页页面
                function refresh(){
                	//刷新并跳转到第一页
                	$table.bootstrapTable('selectPage',1);
                	//$table.bootstrapTable('refresh');
                };
                $("#btn_query").click(function(){
                	window.searchName=$("#searchName").val();
                	window.searchFocus=$("#searchFocus").val();
                	window.searchSex=$("#searchSex").val();
                	window.searchFrom=$("#searchFrom").val();
                	window.searchTo=$("#searchTo").val();
                	window.searchJob=$("#searchJob").val();
                	window.searchChannel=$("#searchChannel").val();
                	window.searchStatus=$("#searchStatus").val();
                	window.searchBumen=$("#searchBumen").val();
                	refresh();
                });
                $("#btn_more_query").click(function(){
                	window.moreSearch=$("#moreSearch").val();
                	refresh();
                });
            });
        </script>

    
    </body>
</html>